﻿using System;
using System.Collections;

namespace 集合作业
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入班级人数");
            int rs = Convert.ToInt32(Console.ReadLine());
            ArrayList a = new ArrayList(rs);
            double sum =0;
            double avgsum = 0;
            double avg =0;
            string yyname = "";
            for (int i = 0; i < rs; i++)
            {
                Console.WriteLine("请输入第{0}个学生的学号",i+1);
                int no = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("请输入第{0}个学生的姓名", i + 1);
                string name = Console.ReadLine();
                Console.WriteLine("请输入第{0}个学生的语文成绩", i + 1);
                double yw = Convert.ToDouble(Console.ReadLine());
                Console.WriteLine("请输入第{0}个学生的数学成绩", i + 1);
                double sx = Convert.ToDouble(Console.ReadLine());
                Console.WriteLine("请输入第{0}个学生的英语成绩", i + 1);
                double yy = Convert.ToDouble(Console.ReadLine());
                student a1 = new student(no, name, yw, sx, yy);
                sum += yw;
                avgsum += sx;
                a.Add(a1);
                double max = ((student)a[0]).Yy;
                if (max <((student)a[i]).Yy)
                {
                    max = ((student)a[i]).Yy;
                    yyname = ((student)a[i]).Name;
                }
            }
            avg = avgsum / rs;
            foreach (var i in a)
            {
                student obj = (student)i;
                Console.WriteLine("学号{0} 姓名{1} 语文{2} 数学{3} 英语{4}",
                    obj.No,obj.Name,obj.Yw,obj.Sx,obj.Yy);
            }
            Console.WriteLine("语文总分{0}",sum);
            Console.WriteLine("数学平均分{0}",avg);
            Console.WriteLine("英语最高分姓名{0}",yyname);
        }
    }
}
